From: Florian Müllner Date: Tue, 29 Jan 2019 22:00:46 +0000 (+0100) Subject: iconGrid: Remove unreachable code X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~87 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=37e0a73c8fe25123b341ecdd49ed3ae4604d0506;p=gnome-shell.git iconGrid: Remove unreachable code Throwing an exception already aborts a function, so there's no need for a return statement in that case. Spotted by eslint. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375 --- diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index cd54d50a3..452dc0c96 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -906,10 +906,8 @@ var PaginatedIconGrid = GObject.registerClass({ getItemPage(item) { let children = this._getVisibleChildren(); let index = children.indexOf(item); - if (index == -1) { + if (index == -1) throw new Error('Item not found.'); - return 0; - } return Math.floor(index / this._childrenPerPage); } @@ -924,10 +922,9 @@ var PaginatedIconGrid = GObject.registerClass({ openExtraSpace(sourceItem, side, nRows) { let children = this._getVisibleChildren(); let index = children.indexOf(sourceItem.actor); - if (index == -1) { + if (index == -1) throw new Error('Item not found.'); - return; - } + let pageIndex = Math.floor(index / this._childrenPerPage); let pageOffset = pageIndex * this._childrenPerPage;